package com.elitect.ftptransfer;

import java.util.List;

import org.apache.commons.net.ftp.FTPFile;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import com.elitect.ftptransfer.network.NetworkUtils;
import com.elitect.ftptransfer.network.OnFTPConnectListener;

/**
 * The common activity of this application
 * 
 * @author NgocTan
 * 
 */
public class FtpTransferActivity extends Activity implements
        OnFTPConnectListener
{
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        NetworkUtils.setOnNetworkListener(this);
    }

    protected void startActivity(Class<?> class1)
    {
        startActivity(new Intent(this, class1));
    }

    /**
     * The debug string function that message is showed in logcat
     * 
     * @param debugString
     *            the string will be showed
     */
    protected void debug(String debugString)
    {
        Log.d(getClass().toString(), "@@@@@@ " + debugString);
    }

    /**
     * The toast with long type
     * 
     * @param toastString
     *            the string will be toasted
     */
    protected void toastLong(final String toastString)
    {
        runOnUiThread(new Runnable()
        {
            @Override
            public void run()
            {
                Toast.makeText(FtpTransferActivity.this, toastString,
                        Toast.LENGTH_LONG).show();
            }
        });
    }

    /**
     * The toast with short type
     * 
     * @param toastString
     *            the string will be toasted
     */
    protected void toastShort(final String toastString)
    {
        runOnUiThread(new Runnable()
        {
            @Override
            public void run()
            {
                Toast.makeText(FtpTransferActivity.this, toastString,
                        Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    public void onFtpLoginSuccess()
    {
    }

    @Override
    public void onFtpLoginFail()
    {
    }

    @Override
    public void onFtpConnectSuccess()
    {
    }

    @Override
    public void onFtpConnectFail()
    {
    }

    @Override
    public void onFtpLoadedFiles(String path, FTPFile[] ftpFiles)
    {
    }

    @Override
    public void onFtpUploaded(List<String> listSucessUploadFiles,
            List<String> listFailUploadFiles)
    {
    }

    @Override
    public void onFtpDownloaded(List<String> listSucessDownloadFiles,
            List<String> listFailDownloadFiles)
    {
    }

    @Override
    public void onFtpCreateFolderSuccessful()
    {
    }

    @Override
    public void onFtpCreateFolderFail()
    {
    }

    @Override
    public void onFtpDisconnect()
    {
    }

    @Override
    public void onFtpLoadFilesFail()
    {
    }

    @Override
    public void onFtpUploadFailAll()
    {
    }

    @Override
    public void onFtpDownloadFailAll()
    {
    }
}
